{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "0a24c360",
   "metadata": {},
   "outputs": [],
   "source": [
    "import matplotlib as plt\n",
    "import math"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "182a2fab",
   "metadata": {},
   "source": [
    "$$V_{bond}=\\frac{1}{2} * k_b * (r-b_0)^2$$"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "12fa1289",
   "metadata": {},
   "outputs": [],
   "source": [
    "def bond(r, b0, k_b):\n",
    "    return 0.5 * k_b * (r-b0)**2\n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "43cbecc3",
   "metadata": {},
   "source": [
    "$$V_{bond}=\\frac{1}{2} * k_b * (r-b_0)^2$$"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "6c05b2c5",
   "metadata": {},
   "outputs": [],
   "source": [
    "def angle(theta, theta_0, k_theta):\n",
    "    k_theta = k_theta /180/180*math.pi*math.pi\n",
    "    return 0.5 * k_theta * (theta - theta_0)**2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "6771bb66",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0.18026957934090007\n"
     ]
    }
   ],
   "source": [
    "bond_list = [0.1091192,0.1091192,0.1091192,0.1091192]\n",
    "b0 = 0.10969\n",
    "k_b =276646.080000\n",
    "V_bond = 0\n",
    "for i in bond_list:\n",
    "    V_bond += bond(i, b0, k_b)\n",
    "print(V_bond)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "eb315c3e",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "1.077591825727359\n"
     ]
    }
   ],
   "source": [
    "angle_list = [109.4712143,109.4712143,109.4712143,109.4712143,109.4712143,109.4712143]\n",
    "theta_0 =  107.5800459\n",
    "k_theta = 329.699200\n",
    "V_angle = 0\n",
    "for i in angle_list:\n",
    "    V_angle += angle(i, theta_0, k_theta)\n",
    "print(V_angle)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "ffda06f3",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "06ba7461",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
